package ljl.alg.jianzhioffer.round3.easy;

public class _42_maxSubArray {

    public int maxSubArray(int[] nums) {
        int max = nums[0], cur = 0;
        for (int num : nums) {
            cur = Math.max(cur + num, num);
            max = Math.max(cur, max);
        }
        return max;
    }
}
